import {
  createRouter,
  createWebHistory,
  createWebHashHistory,
} from "vue-router";
import Axios1 from "../page/小测试/axios测试1.vue";
import Axios2 from "../page/小测试/axios测试2.vue";
import UserWrapper from "../page/路由/包裹.vue";
import UserList from "../page/路由/列表.vue";
import UserDetail from "../page/路由/详情.vue";

const routerInstance = createRouter({
  history: createWebHistory(),
  routes: [
    { path: "/", redirect: "/user" },
    { path: "/axios1", component: Axios1 },
    { path: "/axios2", component: Axios2 },
    {
      path: "/user",
      component: UserWrapper,
      redirect: { name: "userDetail" },
      children: [
        // /user/list
        { path: "list", component: UserList, meta: { title: "用户列表" } },
        // /user/detail
        {
          path: "detail",
          name: "userDetail",
          component: UserDetail,
          meta: { title: "用户详情" },
        },
        { path: "detail1/:number", component: UserDetail },
      ],
    },
  ],
});

export default routerInstance;
